<template>
	<view class="pagedefbg">
		
		<view class="OuterBox" >
			
			<view class="DetailsTmplate user-info FlexBetween">
				<view class="u-flex-between">
					<view class="user-img">
						<u-avatar :src="headImg" size="112" shape="circle"></u-avatar>
					</view>
					<view class="">
						<view class="user-name">
							{{name}}
						</view>
						<view class="u-flex" style="margin-top: 12rpx;">
							<view class="u-flex">
								<u-icon name="phone-fill" color="#fd7400" size="38"></u-icon>
							</view>
							<view class="text-gray u-flex mes">
								{{phone}}
							</view>
						</view>
					</view>
				</view>
				<view class="check" @click="reSwitch">
					<u-icon name="account" color="#333" size="56"></u-icon>
					<view class="">
						切换
					</view>
				</view>
			</view>
			
			<view class="DetailsTmplate card-list">
			
				<view class="card-item  u-flex-between" @click="goOrganization">
					<view class="left u-flex">
						<view class="mr-10">
							<u-icon name="plus-people-fill" color="#fd7400" size="56"></u-icon>
						</view>
						<view class="u-flex-center f700 ">
							成员账号管理
						</view>
					</view>
					<view class="right u-flex-center">
						<u-icon name="arrow-right" color="color: rgb(196, 196, 196);" size="28"></u-icon>
					</view>
				</view>
				<view class="card-item u-flex-between" @click="goAuthority">
					<view class="left u-flex">
						<view class="mr-10">
							<u-icon name="setting-fill" color="#fd7400" size="56"></u-icon>
						</view>
						<view class="u-flex-center f700">
							角色权限管理
						</view>
					</view>
					<view class="right u-flex-center">
						<u-icon name="arrow-right" color="color: rgb(196, 196, 196);" size="28"></u-icon>
					</view>
				</view>
				
				
			</view>

		</view>
		
		<view class="suspension">
			<view class="orangeBtn FlexRow" @click="outLogin">
				退出登录
			</view>
		</view>
		
		
		
				

	</view>
</template>

<script>
	
	export default {
		
		data() {
			return {
				data: '',
				name: '',
				phone: '',
				headImg: '',
			}
		},
		onLoad() {
			let user_str = uni.getStorageSync('data')
			let user_data = JSON.parse(decodeURIComponent(user_str))
			if(user_data) {
				let {
					headimg, name, phone
				} = user_data
				this.headimg = headimg
				this.name = name
				this.phone = phone
			}
			// 获取系统信息
			const systemInfo = wx.getSystemInfoSync();
			// 计算tabBar高度
			// const tabBarHeight = systemInfo.windowHeight - systemInfo.statusBarHeight;
			// console.log('tabBar高度为：', tabBarHeight);
			console.log(systemInfo)
			console.log(systemInfo.statusBarHeight + (systemInfo.screenHeight - systemInfo.safeArea.bottom))
			uni.setStorageSync('tabbarHeight', systemInfo.statusBarHeight + (systemInfo.screenHeight - systemInfo.safeArea.bottom))
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.getPullRefresh()
		},
		methods: {
			// 下拉刷新请求数据
			getPullRefresh(){
				console.clear()
				
				
				uni.stopPullDownRefresh()
			},
			outLogin() {
				console.log('outLogin', )
				uni.showModal({
					content: '是否退出登录',
					confirmColor: "#fd7400",
					confirmText: '确认',
					success: res => {
						if (!res.confirm) return
						uni.reLaunch({
							url: '/pages/login/login'
						}) 
					}
				})
			},
			reSwitch() {
				let Switch_data = uni.getStorageSync('userInfo');
				console.log(Switch_data)
				if (!Switch_data) return
				uni.navigateTo({
					url: `../login/applytip?data=${Switch_data}`
				})
			},
			changeUser() {
				uni.showToast({
					title: '此功能正在开发',
					icon: "none",
				});
			},
			goAuthority() {
				uni.showLoading({
					title: '加载中'
				});
				setTimeout(function() {
					uni.hideLoading();
					uni.navigateTo({
						url: '../../pagesA/pages/authority/authority'
					})
				}, 2000);
			},
			goOrganization() {
				uni.navigateTo({
					url: '../../pagesA/pages/organization/organization'
				})
			},
			
			
		}
	}
</script>

<style lang="scss" scoped>
	
	
	
	.user-info {
		padding: 62rpx 30rpx;
		.user-img {
			margin-right: 30rpx;
		}
		.user-name {
			font-size: 40rpx;
			font-weight: 700;
		}
		.mes {
			font-size: 26rpx;
			margin-left: 4px;
		}
		.right {
			width: 100%;
		}
	}
	
	.card-list {
		.card-item {
			padding: 30rpx 30rpx;
			// border:solid 1px red;
		}
		
	}
	
	
</style>